// 项目中我们大多数时候都会把对应的接口请求封装成api来调用
import service from "./service";
import qs from 'qs'

//登录接口
export const login = (data) => service({
    url: '/login',
    method: 'post',
    data
})

//学生列表的查询接口
export function getStudentList(params) {
    return service({
        url: '/students',
        method: 'get',
        params
    })
}

//删除学生信息接口
export const delStudentInfo = (id) => service({
    url: `/students/${id}`,
    method: 'delete'
})

//信息列表新增接口
export const addStudentInfo = (data) => {
    data = qs.stringify(data)
    return service({
        method: 'post',
        url: '/info',
        data
    })
}

//信息列表修改接口
export const updateStudentInfo = (data) => {
    data = qs.stringify(data)
    return service({
        method: 'put',
        url: '/info',
        data
    })
}

//信息列表查询接口
export const queryStudentInfo = () => service({
    url: '/info',
    method: 'get',
})

//信息列表的删除接口
export const delInfo = (id) => service({
    url: `/info/${id}`,
    method: 'delete'
})

//作业列表查询/分页查询接口
export const workList = (params) => service({
    url: '/works',
    method: 'get',
    params
})